import { IsInt, IsNotEmpty, IsOptional, IsString, MaxLength, Min } from 'class-validator'

// 商品新增与修改 DTO
export class CreateGoodsDto {
  @IsInt()
  supplierId: number

  @IsInt()
  categoryId: number

  @IsString()
  @IsNotEmpty()
  @MaxLength(120)
  title: string

  @IsString()
  @IsOptional()
  @MaxLength(255)
  subtitle?: string

  @IsString()
  @IsOptional()
  @MaxLength(255)
  cover?: string

  @IsString()
  @IsOptional()
  descHtml?: string

  @IsInt()
  @IsOptional()
  status?: number = 1

  @IsInt()
  @IsOptional()
  auditStatus?: number = 1
}

export class UpdateGoodsDto extends CreateGoodsDto {
  @IsInt()
  @Min(1)
  goodsId: number
}
